home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-08-31 | 570 b | 34 lines | [TEXT/KAHL] |
- void PutChar(char c);
- void PutText(const char* s, int len );
- void __BinToText (unsigned long bin, char* str );
-
-
- void PutBinary (unsigned long i, int nz)
- {
- char* str = "00000000000000000000000000000000";
- int firstNz;
-
- if ( nz > 0 && nz <= 32 )
- {
- firstNz = nz;
-
- __BinToText (i, str );
-
- PutChar( '~' );
-
- while ( nz % 4 )
- {
- PutChar( str[32-nz] );
- nz--;
- }
-
- if ( nz && nz != firstNz ) PutChar(',');
-
- while ( nz ) // on entry, nz is a multiple of 4
- {
- PutText( &str[32-nz], 4 );
- nz -= 4;
- if ( nz ) PutChar(',');
- }
- }
- }